<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="contact.domain.DAOContactGroup"%>
<%@page import="contact.domain.ContactGroup"%>
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<%@page import="org.springframework.context.ApplicationContext" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" media="screen" href="style.css">
<title>Delete group</title>
</head>
<body>
	<jsp:include page="menu.html" />
	<jsp:include page="menuGroup.html" />

	<form id="removeGroup" action="RemoveGroup">
		<h1>Remove Group</h1>
		<table>
			<tr>
				<th>Name</th>
				<th></th>
			</tr>
			<%
			ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
			DAOContactGroup daoGroup = (DAOContactGroup) context.getBean("DAOContactGroup");
			List<ContactGroup> groups = daoGroup.readAll();
			for (ContactGroup group : groups){
				out.println("<tr>"
					+"<td>" + group.getGroupName() + "</td>"
					+"<td>" + "<input type=\"radio\" name=\"id\" value=\""
						+ group.getGroupId() + "\"></input></td></tr>");
			}
			%>
		</table>
		<h2>
			<input type="submit" value="Remove" />
		</h2>
	</form>
	</form>
</body>
</html>